package com.sjb.cp.common;

import com.sjb.cp.exception.ErrorCode;
import lombok.Data;

import java.io.Serializable;

/**
 * @Author:sjb
 * @CreateTime:2024-12-09
 * @Description: 响应类
 * @Version：1.0
 */
@Data
public class BaseResponse<T> implements Serializable {

    private int code;

    private String msg;

    private T data;

    public BaseResponse(int code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public BaseResponse(int code, T data){
        this(code, "", data);
    }

    public BaseResponse(ErrorCode errorCode){
        this(errorCode.getCode(), errorCode.getMessage(), null);
    }


}
